home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk54
/
icontype
/
icontype.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
2KB
|
73 lines
/* IconType - a program to change the type of icon. Useful for changing
* an icon's type after editing with IconEd.
*
* Icon types are Disk, Drawer, Tool, Project, Garbage, and Device
*
* Syntax: icontype <filename> <type>
*
* Example: icontype test.info project
* (changes the icon "test.info" to a project icon)
*
* by: Larry Phillips, CIS 76703,4322
*/
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "exec/libraries.h"
#include "exec/ports.h"
#include "exec/interrupts.h"
#include "exec/io.h"
#include "exec/memory.h"
#include "libraries/dos.h"
#include "libraries/dosextens.h"
extern struct FileHandle *Open();
main (argc,argv)
int argc;
char *argv[];
{
struct FileHandle *file;
unsigned char buf;
static char *type[7] = { "","disk","drawer","tool","project","garbage","device" };
if ((argc < 3)||(argc > 3))
{
puts("Usage: IconType <filename> <type>\nTypes are disk, drawer, tool, project, garbage, device.");
}
else
{
if ((file = Open(argv[1],MODE_OLDFILE))==0)
{
puts ("Unable to open icon file.");
exit(205);
}
Read (file,&buf,1L);
if (buf == 0xE3)
{
Read (file,&buf,1L);
if (buf == 0x10)
{
Seek (file, 48L,(long) OFFSET_BEGINNING);
tolower (argv[2]);
for (buf = 1;buf < 7;buf++)
if (strcmp(argv[2],type[buf])==0)
{
Write (file,&buf,1L);
break;
}
if (buf == 7) puts ("Invalid icon type.");
}
else puts ("Not an icon file.");
}
else puts ("Not an icon file.");
Close (file);
}
}